//
//  MoneyRechargeVC.m
//  phmall
//
//  Created by admin on 2017/11/13.
//  Copyright © 2017年 admin. All rights reserved.
//

#import "MoneyRechargeVC.h"

@interface MoneyRechargeVC ()<UITableViewDelegate,UITableViewDataSource>
@property(strong,nonatomic)UITableView *myTableview;
@end

@implementation MoneyRechargeVC
-(void)rightBarAction{
    
    
}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.navBarBgAlpha=@"1.0";
    //    // 改变NavBar顶层View的颜色
    self.navigationController.navigationBar.barTintColor =  [UIColor whiteColor];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    UIBarButtonItem*  rightBar=[[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"帮助"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStylePlain target:self action:@selector(rightBarAction)];
    
    self.navigationItem.rightBarButtonItem=rightBar;
    
    UIBarButtonItem* leftBar=[[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"返回"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStyleDone target:self action:@selector(leftBarAction)];
    self.navigationItem.leftBarButtonItem=leftBar;
    

    
    [self.view addSubview:self.myTableview];
    [self.myTableview mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).offset(0);
        make.left.right.equalTo(self.view).priorityHigh();
        make.bottom.equalTo(self.view).with.offset(0).priorityHigh();
    }];
    
    UIView *headerView=[UIView new];
    headerView.backgroundColor=[UIColor groupTableViewBackgroundColor];
    
    UIView *back=[[UIView alloc]init];
    back.backgroundColor=[UIColor whiteColor];
    ViewBorderRadius(back, 5, 0, [UIColor clearColor]);
    [headerView addSubview:back];
    [back mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.offset(10);
        make.left.offset(10);
        make.right.offset(-10).priorityHigh();
        make.height.offset(240);
        make.bottom.offset(-10);
    }];
    
    UILabel *card=[[UILabel alloc]init];
    card.text=@"银行卡";
    card.font=[UIFont systemFontOfSize:16];
    [back addSubview:card];
    [card mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(10);
        make.top.offset(35);
    }];
    
    UILabel *number=[[UILabel alloc]init];
    number.text=@"中国建设银行";
    number.textColor=[UIColor colorWithHexString:@"#4398c0"];
    number.font=[UIFont systemFontOfSize:16];
    [back addSubview:number];
    [number mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(card.mas_right).offset(10);
        make.top.offset(35);
    }];
    
    UIView *line=[[UIView alloc]init];
    line.backgroundColor=[UIColor groupTableViewBackgroundColor];
    [back addSubview:line];
    [line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.offset(0);
        make.height.offset(1);
        make.top.equalTo(card.mas_bottom).offset(35);
    }];
    
    UILabel *moneyLabel=[[UILabel alloc]init];
    moneyLabel.text=@"充值金额";
    moneyLabel.font=[UIFont systemFontOfSize:16];
    [back addSubview:moneyLabel];
    [moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(10);
        make.top.equalTo(line).offset(10);
    }];
    
    UILabel *symbol=[[UILabel alloc]init];
    symbol.text=@"₱";
    //    symbol.textColor=[UIColor colorWithHexString:@"#4398c0"];
    symbol.font=[UIFont systemFontOfSize:30];
    [back addSubview:symbol];
    [symbol mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(10);
        make.top.equalTo(moneyLabel.mas_bottom).offset(10);
    }];
    
    UITextField *money=[[UITextField alloc]init];
    money.placeholder=@"充值金额";
    [back addSubview:money];
    money.font=[UIFont systemFontOfSize:30];
    [money mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(symbol.mas_right).offset(5);
        make.centerY.equalTo(symbol);
    }];
    
    UIView *passLine=[[UILabel alloc]init];
    [back addSubview:passLine];
    passLine.backgroundColor=[UIColor orangeColor];
    [passLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(symbol.mas_bottom);
        make.right.equalTo(back.mas_right).with.offset(-10);
        make.left.equalTo(back).with.offset(10);
        make.height.offset(1);
    }];
    
    UIButton* next=[UIButton buttonWithType:UIButtonTypeCustom];
    [back addSubview:next];
    [next setTitle:@"确定" forState:UIControlStateNormal];
    [next addTarget:self action:@selector(nextAction) forControlEvents:UIControlEventTouchUpInside];
    [next setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    //    next.backgroundColor=[UIColor colorWithHexString:@"#ff9300"];
    //    ViewBorderRadius(next, 5, 1, [UIColor colorWithHexString:@"#ff9300"]);
    [next setBackgroundImage:[UIImage imageNamed:@"背景渐变条"] forState:UIControlStateNormal];
    [next mas_updateConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(passLine.mas_bottom).with.offset(15);
        make.height.offset(40);
        make.left.equalTo(back).with.offset(20);
        make.right.equalTo(back.mas_right).with.offset(-20);
    }];
    
    CGFloat height = [headerView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height;
    CGRect frame = headerView.bounds;
    frame.size.height = height;
    headerView.frame = frame;
    [self.myTableview setTableHeaderView:headerView];
    // Do any additional setup after loading the view.
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 0;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return 1;
    
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 0.01;
}
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *ID = @"newCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
        cell.selectionStyle=UITableViewCellSelectionStyleNone;;
    }
    cell.opaque=YES;
    cell.layer.drawsAsynchronously=YES;
    cell.layer.rasterizationScale=[UIScreen mainScreen].scale;
    return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
}
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
    //分割线补全
    if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
        [cell setLayoutMargins:UIEdgeInsetsZero];
    }
    if ([cell respondsToSelector:@selector(setSeparatorInset:)]){
        [cell setSeparatorInset:UIEdgeInsetsZero];
    }
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
//MARK:-GETTER
- (UITableView *)myTableview{
    if (!_myTableview) {
        _myTableview = [[UITableView alloc]initWithFrame:CGRectZero style:UITableViewStyleGrouped];
        _myTableview.delegate = self;
        _myTableview.dataSource = self;
        _myTableview.backgroundColor=[UIColor groupTableViewBackgroundColor];
        _myTableview.separatorStyle = UITableViewCellSeparatorStyleNone;
        _myTableview.showsVerticalScrollIndicator=NO;
        //        _myTableview.emptyDataSetSource=self;
        //        _myTableview.emptyDataSetDelegate=self;
        _myTableview.scrollEnabled = YES;
    }
    return _myTableview;
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end

